feat: support plugin configuration in bsconfig and CLI#1706
Draft
TwitchBronBron wants to merge 2 commits into
Draft
feat: support plugin configuration in bsconfig and CLI#1706TwitchBronBron wants to merge 2 commits into
TwitchBronBron wants to merge 2 commits into
Conversation
Allow `plugins` entries in `bsconfig.json` to be objects with `src`, optional `name`, and optional `config` (inline object or path to a JSONC file) in addition to the existing string shorthand. Introduces a new `Plugin.onSetConfiguration(config)` lifecycle hook that fires on every plugin immediately after load. CLI flags of the form `--plugin.<name>.<key>=<value>` deep-merge on top of the bsconfig plugin config. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
|
Should this be in v1? If not, can we change some stuff to match what v1 is doing with plugins? For Example changing event names.. "onSetConfiguration" -> "setConfiguration" (verb_noun format) |
… plugin overrides - Pre-tokenize argv for --plugin <src> [<name>] pairs (yargs can't natively distinguish a name positional from another src in an array form). - Add `pluginOverrides` runtime field with replace/merge semantics: bare --plugin.<id>=<value> fully replaces the bsconfig config (loading a JSONC file if the value is a path); --plugin.<id>.<prop>=<value> deep-merges. - Resolve override identifiers with strict precedence: bsconfig user-supplied `name` → factory `name` → bsconfig `src`. A higher-priority match wins outright; ambiguity at the chosen level hard-fails with a clear message. - Add a flat-key parser supporting double-quoted segments at any position so ids/props containing dots can be addressed without escaping. - Document the new CLI behavior and naming precedence in docs/plugins.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
TwitchBronBron
commented
May 13, 2026
| @@ -25,12 +28,7 @@ let options = yargs | |||
| .option('cwd', { type: 'string', description: 'Override the current working directory.' }) | |||
| .option('copy-to-staging', { type: 'boolean', defaultDescription: 'true', description: 'Copy project files into the staging folder, ready to be packaged.' }) | |||
| .option('diagnostic-level', { type: 'string', defaultDescription: '"warn"', description: 'Specify what diagnostic types should be printed to the console. Value can be "error", "warn", "hint", "info".' }) | |||
Member
Author
There was a problem hiding this comment.
We need to discuss this, because it's technically a breaking change to remove this alias.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds plugin configuration support to both
bsconfig.jsonand the CLI, plus a newPlugin.onSetConfiguration(config)lifecycle hook that fires immediately after every plugin is loaded.bsconfig.json
pluginsentries can now be objects withsrc,name?, andconfig?(the previous string shorthand still works):{ "plugins": [ "./scripts/myPlugin.js", { "src": "@rokucommunity/bslint", "name": "bslint", "config": "./bslint.jsonc" }, { "src": "./scripts/custom.js", "config": { "severity": "error" } } ] }configis either an inline object or a path to a JSONC file (comments and trailing commas allowed).CLI
Load and name with
--plugin <src> [<name>](repeatable):bsc --plugin "@rokucommunity/bslint" bslint \ --plugin ./scripts/custom.js house-rulesOverride config with
--plugin.<id>.<prop>=<value>(deep-merge):Replace config entirely with a bare
--plugin.<id>=<value>(no dotted path); if the value is a path, the JSONC file is loaded. Combinable with merge — replace is always applied first regardless of CLI order:# Loads ./ci-bslint.jsonc as the whole config, then overrides `severity` bsc --plugin.bslint=./ci-bslint.jsonc --plugin.bslint.severity=hintQuoted segments anywhere in the dotted key handle ids/props containing dots:
ID resolution
<id>is matched against loaded plugins with strict precedence — a higher-priority match wins outright, and lower-level collisions are ignored:namenamesrc(as written)Ambiguity at the chosen level hard-fails with a message listing the conflicting plugins.
Full docs (with more examples) in
docs/plugins.md.🤖 Generated with Claude Code